<template>
  <div class="rank">
    <!-- 热门电台榜 -->
    <div class="hot-rank">
      <p class="title">热门电台榜</p>
      <div class="content"
           v-for="(item, index) in Hotradiolist"
           :key="index"
           :class="{diff:index%2==0}"
           @click="enterDetail(item.id)">
        <div class="left">
          <img :src="item.picUrl"
               alt="">
        </div>
        <div class="right">
          <div class="des">
            <p class="info">{{item.rcmdtext}}</p>
            <p class="name">{{item.name}}</p>
          </div>
          <div class="type">
            <p> {{item.category}}</p>
          </div>
        </div>
      </div>
    </div>
    <div class="new-rank">
      <p class="title">新晋电台榜</p>
      <div class="content"
           v-for="(item, index) in Newradiolist"
           :key="index"
           :class="{diff:index%2==0}"
           @click="enterDetail(item.id)">
        <div class="left">
          <img :src="item.picUrl"
               alt="">
        </div>
        <div class="right">
          <div class="des">
            <p class="info">{{item.rcmdtext}}</p>
            <p class="name">{{item.name}}</p>
          </div>
          <div class="type">
            <p v-if="item.category"> {{item.category}}</p>
            <p v-else>无</p>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import Scroll from 'components/common/scroll/Scroll.vue'
export default {
  components: { Scroll },
  props: {
    Hotradiolist: {
      type: Array,
      default () {
        return []
      }
    },
    Newradiolist: {
      type: Array,
      default () {
        return []
      }
    }
  },
  methods: {
    enterDetail (id) {
      this.$router.push('/program/' + id);
    }
  }

}
</script>

<style scoped>
.rank {
  width: 100%;
  height: 100%;
  display: flex;
  margin-top: 15px;
}
.hot-rank {
  width: 50%;
  margin-right: 40px;
}
.hot-rank .title,
.new-rank .title {
  width: 100%;
  height: 40px;
  font-size: 25px;
  border-bottom: 2px solid #00aa85;
}
.content {
  height: 60px;
  display: flex;
  margin: 3px;
}
.content:hover {
  background: #f7f7f7;
}
.content .left {
  width: 13%;
  height: 100%;
  margin-left: 20px;
}
.left img {
  width: 50px;
  height: 50px;
  margin: 6px;
}
.right {
  flex: 1;
  height: 100%;
  display: flex;
}
.right .des {
  width: 70%;
  height: 100%;
  overflow: hidden;
  padding: 10px 10px 0;
}
.des p {
  width: 100%;
  overflow: hidden;
  line-height: 20px;
  font-size: 12px;
}
.des .name {
  color: #333;
}
.right .type {
  flex: 1;
  margin: 24px 30px;
}
.type p {
  font-size: 12px;
  width: 100%;
  text-align: center;
  height: 20px;
  border: 1px solid #ddd;
}
.new-rank {
  flex: 1;
}
.diff {
  background: #f7f7f7;
}
</style>
